<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/testRelease.do" />

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_release.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>

<SCRIPT language="JavaScript">
window.onload = init;

function init()
{
    qs_1 = new QuickSearch(document.testReleaseForm['searchToProcessStepId'], document.testReleaseForm.qs1, false);
    qs_2 = new QuickSearch(document.testReleaseForm['searchLotNumber'], document.testReleaseForm.qs2, false);
}

function search()
{
    document.testReleaseForm.searchWithCompulsoryFields.value = 'true';
    document.testReleaseForm.action = "<%=chipTracContext%>/testRelease.do?action=searchReleases";
    document.testReleaseForm.submit();
}

function reset()
{
    document.testReleaseForm.reset();
    qs_1.resetQuickSearchCntrl();
    qs_2.resetQuickSearchCntrl();
}

function printView( releaseId )
{
	newWindow = window.open ('<%=chipTracContext%>/testRelease.do?action=printerFriendly&releaseId='+releaseId,'printerFreindlyPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
}
function sendMail ( releaseId, category, vendor )
{
    newWindow = window.open ('<%=chipTracContext%>/releaseSendMail.do?releaseId=' + releaseId + '&vendor='+vendor+'&Category='+category+'&processType=Test&sendMail=PRRMail','testSendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}    
</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
	<tr>
    	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/operations/releaseMenu.jsp" %>
            <!-- end of the side navigations -->
        </td>
        <td bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></td>
	    <td bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td>
	    <td valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
	        <BR>
        	<html:form action="/testRelease.do" method="POST" type="com.scalar.chiptrack.operations.release.forms.testReleaseForm">
    		<table width="90%" align="center" cellpadding="2" cellspacing="2" border="0">
			    <tr><td colspan="4" class="NArialW" align="center">Test Release</td></tr>
                <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
                <tr><td colspan='4' class="NArialL"><chiptrack:errors styleClass="NArialL"/></td></tr>
                <tr><td colspan='4' class="NArialL"><chiptrack:info styleClass="NArialL"/></td></tr>
                <tr><td colspan='4'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <tr>
                    <td class="NArialL">
                        Quick Search Lot Number:
                    </td>
                    <td class="NArialL">
                        <input type="text" name="qs2" class="txfield" size='26' onkeyup='quickSearch(qs_2)'/>
                    </td>
                    <td class="NArialL" width='30%'>
                        Quick Search Part Number:
                    </td>
                    <td class="NArialL" width='20%'>
                        <input type="text" name="qs1" class="txfield" size='26' onkeyup='quickSearch(qs_1)'/>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">Lot Number:</td>
                    <td class="NArialL">
                        <html:select property="searchLotNumber"  styleClass="txfield" style="width:180px">
                            <html:option value="-1">All</html:option>
                            <logic:present name="lotNumbers">
                                <html:options collection="lotNumbers" property="value" labelProperty="label"/>
                            </logic:present>
                        </html:select>
                    </td>
                    <td class="NArialL">
                        Test Part Number:
                    </td>
                    <td class="NArialL">
                        <html:select property="searchToProcessStepId"  styleClass="txfield" style="width:180px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="partNumberList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">Test Vendor:</td>
                    <td class="NArialL">
                        <html:select property="searchToVendorId"  styleClass="txfield" style="width:180px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="toVendorList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                    <td class="NArialL">Status:</td>
                    <td class="NArialL">
                        <html:select property="searchStatus"  styleClass="txfield" style="width:180px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="statusList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">Year:</td>
                    <td class="NArialL">
                        <html:select property="searchYear"  styleClass="txfield" style="width:180px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="yearList" property="value" labelProperty="label"/>
                        </html:select>
                        <input type="hidden" name="searchWithCompulsoryFields" />
                    </td>
                    <td colspan='2'/>
                </tr>
                <tr><td colspan='4'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='5'></td></tr>
                <tr><td colspan='4'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <tr>
                    <td colspan="5" align="center">
                        <a href="javascript:search()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Test Release';return true" onmouseout="window.status='';return true" title="Click here to Search for Test Release"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                    </td>
                </tr>
                <tr>
                    <td colspan='4' class="NArialL">
                        Please
                        <chiptrack:restrictedLink functionality='<%=Functionality.TEST_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext+"/testRelease.do?action=searchNew"%>' onmouseover="window.status='Click to Create Test Release';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink>
                        to generate new Test Release
                    </td>
                </tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <logic:present name="testReleaseList" scope="request">
                <tr>
                    <td colspan='4'>
                        <table width="100%" align="left" cellpadding="2" cellspacing="2" border="0">
                            <tr>
                                <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Test Rel No</font>
                                </td>
                                <td width="8%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Email</font>
                                </td>
                                <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Vendor Name</font>
                                </td>
                                <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Part Number</font>
                                </td>
                                <%--<td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Lot Number</font>
                                </td>--%>
                                <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Release Date</font>
                                </td>
                                <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                    <font color="#FFFFFF">Status</font>
                                </td>
                                <td width="55%" class="NArialL" bgcolor="#993333" align="center">
                                   <font color="#FFFFFF">Actions</font>
                                </td>
                            </tr>
                            <logic:iterate name="testReleaseList" id="testRelease" type="com.scalar.chiptrack.operations.release.ReleaseLot" indexId="iteratorIdx" >
                                <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                    <td class="NArialL" align="center">
                                        <bean:write name="testRelease" property="releaseNumber" />
                                    </td>
                                    <td class="NArialL" align="center">
                                    <a href="javascript:sendMail('<bean:write name="testRelease" property="releaseId"/>','<bean:write name="testRelease" property="lotCategory"/>','<bean:write name="testRelease" property="fromVendorName"/>');" title='Click to Mail Test Release Instructions'>Email </a>
                                    </td>
                                    <td class="NArialL" align="center">
                                        <bean:write name="testRelease" property="fromVendorName" />
                                    </td>
                                    <td  class="NArialL" align="center">
                                        <bean:write name="testRelease" property="partNumber" />
                                    </td>
                                    <%--<td class="NArialL" align="center">
                                        <bean:write name="testRelease" property="lotNumber" />
                                    </td>--%>
                                    <td class="NArialL" align="center">
                                        <bean:write name="testRelease" property="releaseDate" />
                                    </td>
                                    <td class="NArialL" align="center">
                                        <bean:write name="testRelease" property="status"/>
                                    </td>
                                    <td class="NArialL" align="center" NOWRAP>
                                        <logic:notEqual name="testRelease" property="status" value='CANCELLED'>
                                            <logic:notEqual name="testRelease" property="status" value='CLOSED'>
                                                <%--<a href="javascript:printView(<bean:write name="testRelease" property="releaseId" />)" onMouseOver="window.status='Click to View Test Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <a href="<%=chipTracContext%>/testRelease.do?action=view&releaseId=<bean:write name="testRelease" property="releaseId"/>" onMouseOver="window.status='Click to View Assembly Release';return true" onMouseout="window.status='';return ">View </a>&nbsp;&nbsp;&nbsp;&nbsp;
                                                <a href='<%=chipTracContext%>/testRelease.do?action=modify&releaseId=<bean:write name="testRelease" property="releaseId" />' onMouseOver="window.status='Click to Modify Test Release';return true" onMouseout="window.status='';return ">Modify</a>&nbsp;&nbsp;&nbsp;
												<logic:notEqual name="testRelease" property="status" value='APPROVED'>
													<a href='<%=chipTracContext%>/testRelease.do?action=approve&releaseId=<bean:write name="testRelease" property="releaseId" />' onMouseOver="window.status='Click to Approve Test Release';return true" onMouseout="window.status='';return ">Approve</a>&nbsp;&nbsp;&nbsp;
												</logic:notEqual>
												<logic:equal name="testRelease" property="status" value='APPROVED'>
														&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												</logic:equal>
                                                <a href='<%=chipTracContext%>/testRelease.do?action=cancel&releaseId=<bean:write name="testRelease" property="releaseId" />' onMouseOver="window.status='Click to Cancel this Test Release';return true" onMouseout="window.status='';return ">Cancel</a>&nbsp;&nbsp;&nbsp;
                                                <a href='<%=chipTracContext%>/testRelease.do?action=close&releaseId=<bean:write name="testRelease" property="releaseId" />' onMouseOver="window.status='Click to Close this Test Release';return true" onMouseout="window.status='';return ">Close</a>&nbsp;&nbsp;&nbsp;
                                           </logic:notEqual>
                                        </logic:notEqual>
                                        <logic:equal name="testRelease" property="status" value='CANCELLED'>
                                            <a href="javascript:printView(<bean:write name="testRelease" property="releaseId" />)" onMouseOver="window.status='Click to View Test Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            Modify&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                        </logic:equal>
                                        <logic:equal name="testRelease" property="status" value='CLOSED'>
                                            <a href="javascript:printView(<bean:write name="testRelease" property="releaseId" />)" onMouseOver="window.status='Click to View Test Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            Modify&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                        </logic:equal>
                                    </td>
                                </tr>
                            </logic:iterate>
                        </table>
                    </TD>
               </TR>
               </logic:present>
        </table>
	</html:form>
<!-- till here -->
<BR><BR><BR></td>
<td bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></td>
</tr>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>
<%--
<% }catch(Exception e){e.printStackTrace();} %>--%>
